﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ChoDiaOc_HK_WPF.Controls;

namespace ChoDiaOc_HK_WPF.Views.TiepNhanDangKy {
    /// <summary>
    /// Interaction logic for KiemTraGiayTo.xaml
    /// </summary>
    public partial class KiemTraGiayTo : UserControl {
        public KiemTraGiayTo() {
            InitializeComponent();
            chkSuDungDat.IsChecked = chkGiayPhepHC.IsChecked = chkGiayPhepXD.IsChecked = chkHopDong.IsChecked = chkSoHuuNha.IsChecked = false;
            if (TiepNhanDangKyController.GetInstance().LoaiDiaOcSource.TenLoaiDiaOc.ToLower().Contains("nhà")) {
                chkSoHuuNha.IsEnabled = true;
            } else {
                chkSoHuuNha.IsEnabled = false;
            }
        }

        private void btnNhapLai_Click(object sender, RoutedEventArgs e) {
            chkSuDungDat.IsChecked = chkGiayPhepHC.IsChecked = chkGiayPhepXD.IsChecked = chkHopDong.IsChecked = chkSoHuuNha.IsChecked = false;
            if (TiepNhanDangKyController.GetInstance().LoaiDiaOcSource.TenLoaiDiaOc.ToLower().Contains("nhà")) {
                chkSoHuuNha.IsEnabled = true;
            } else {
                chkSoHuuNha.IsEnabled = false;
            }
        }

        private void btnHoanTat_Click(object sender, RoutedEventArgs e) {
            if (chkSuDungDat.IsChecked == true && chkGiayPhepHC.IsChecked == true && chkGiayPhepXD.IsChecked == true) {
                if (TiepNhanDangKyController.GetInstance().LoaiDiaOcSource.TenLoaiDiaOc.ToLower().Contains("nhà")) {
                    if (chkSoHuuNha.IsChecked == true) {
                        MessageBox.Show("Thông tin hợp lệ!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None);
                        App.ManHinhTiepNhanDangKy.DoNextStep(4);
                    } else {

                    }
                } else {
                    MessageBox.Show("Thông tin hợp lệ!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None);
                    App.ManHinhTiepNhanDangKy.DoNextStep(4);
                }
            } else {

            }
        }
    }
}